.class Lcom/instagram/android/support/camera/z;
.super Landroid/os/AsyncTask;
.source "LoadImageTask.java"


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "Landroid/os/AsyncTask",
        "<",
        "Landroid/net/Uri;",
        "Ljava/lang/Void;",
        "Ljava/lang/Void;",
        ">;"
    }
.end annotation


# static fields
.field private static final a:Ljava/lang/Class;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/Class",
            "<*>;"
        }
    .end annotation
.end field


# instance fields
.field private b:Landroid/content/Context;

.field private c:Lcom/instagram/android/support/camera/a/c;

.field private d:Landroid/graphics/Bitmap;

.field private e:Lcom/instagram/android/support/camera/aa;

.field private f:Lcom/instagram/android/support/camera/o;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 24
    const-class v0, Lcom/instagram/android/support/camera/z;

    sput-object v0, Lcom/instagram/android/support/camera/z;->a:Ljava/lang/Class;

    return-void
.end method

.method constructor <init>(Landroid/content/Context;Lcom/instagram/android/support/camera/aa;)V
    .locals 1
    .parameter
    .parameter

    .prologue
    .line 39
    invoke-direct {p0}, Landroid/os/AsyncTask;-><init>()V

    .line 40
    iput-object p1, p0, Lcom/instagram/android/support/camera/z;->b:Landroid/content/Context;

    .line 41
    iput-object p2, p0, Lcom/instagram/android/support/camera/z;->e:Lcom/instagram/android/support/camera/aa;

    .line 42
    new-instance v0, Lcom/instagram/android/support/camera/o;

    invoke-direct {v0}, Lcom/instagram/android/support/camera/o;-><init>()V

    iput-object v0, p0, Lcom/instagram/android/support/camera/z;->f:Lcom/instagram/android/support/camera/o;

    .line 43
    return-void
.end method

.method private a(Landroid/media/ExifInterface;)I
    .locals 2
    .parameter

    .prologue
    .line 123
    const-string v0, "Orientation"

    const/4 v1, 0x1

    invoke-virtual {p1, v0, v1}, Landroid/media/ExifInterface;->getAttributeInt(Ljava/lang/String;I)I

    move-result v0

    .line 125
    packed-switch v0, :pswitch_data_0

    .line 138
    :pswitch_0
    const/4 v0, 0x0

    .line 141
    :goto_0
    return v0

    .line 127
    :pswitch_1
    const/16 v0, 0x5a

    .line 128
    goto :goto_0

    .line 130
    :pswitch_2
    const/16 v0, 0xb4

    .line 131
    goto :goto_0

    .line 133
    :pswitch_3
    const/16 v0, 0x10e

    .line 134
    goto :goto_0

    .line 125
    nop

    :pswitch_data_0
    .packed-switch 0x3
        :pswitch_2
        :pswitch_0
        :pswitch_0
        :pswitch_1
        :pswitch_0
        :pswitch_3
    .end packed-switch
.end method

.method private a(Ljava/lang/String;)V
    .locals 3
    .parameter

    .prologue
    .line 98
    :try_start_0
    new-instance v0, Landroid/media/ExifInterface;

    invoke-direct {v0, p1}, Landroid/media/ExifInterface;-><init>(Ljava/lang/String;)V

    .line 102
    invoke-direct {p0, v0}, Lcom/instagram/android/support/camera/z;->a(Landroid/media/ExifInterface;)I

    move-result v1

    .line 103
    iget-object v2, p0, Lcom/instagram/android/support/camera/z;->f:Lcom/instagram/android/support/camera/o;

    invoke-virtual {v2, v1}, Lcom/instagram/android/support/camera/o;->a(I)V

    .line 106
    invoke-direct {p0, v0}, Lcom/instagram/android/support/camera/z;->b(Landroid/media/ExifInterface;)[Ljava/lang/Double;

    move-result-object v0

    .line 107
    if-eqz v0, :cond_0

    .line 108
    iget-object v1, p0, Lcom/instagram/android/support/camera/z;->f:Lcom/instagram/android/support/camera/o;

    const/4 v2, 0x0

    aget-object v2, v0, v2

    invoke-virtual {v1, v2}, Lcom/instagram/android/support/camera/o;->a(Ljava/lang/Double;)V

    .line 109
    iget-object v1, p0, Lcom/instagram/android/support/camera/z;->f:Lcom/instagram/android/support/camera/o;

    const/4 v2, 0x1

    aget-object v0, v0, v2

    invoke-virtual {v1, v0}, Lcom/instagram/android/support/camera/o;->b(Ljava/lang/Double;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 115
    :cond_0
    :goto_0
    return-void

    .line 112
    :catch_0
    move-exception v0

    .line 113
    sget-object v1, Lcom/instagram/android/support/camera/z;->a:Ljava/lang/Class;

    const-string v2, "Exception caught reading exif data"

    invoke-static {v1, v2, v0}, Lcom/facebook/e/a/a;->b(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_0
.end method

.method private b(Ljava/lang/String;)Ljava/lang/Double;
    .locals 10
    .parameter

    .prologue
    const/4 v9, 0x2

    const/4 v8, 0x1

    const/4 v7, 0x0

    .line 191
    const-string v0, ","

    const/4 v1, 0x3

    invoke-virtual {p1, v0, v1}, Ljava/lang/String;->split(Ljava/lang/String;I)[Ljava/lang/String;

    move-result-object v0

    .line 193
    aget-object v1, v0, v7

    const-string v2, "/"

    invoke-virtual {v1, v2, v9}, Ljava/lang/String;->split(Ljava/lang/String;I)[Ljava/lang/String;

    move-result-object v1

    .line 194
    aget-object v2, v1, v7

    invoke-static {v2}, Ljava/lang/Double;->valueOf(Ljava/lang/String;)Ljava/lang/Double;

    move-result-object v2

    .line 195
    aget-object v1, v1, v8

    invoke-static {v1}, Ljava/lang/Double;->valueOf(Ljava/lang/String;)Ljava/lang/Double;

    move-result-object v1

    .line 196
    invoke-virtual {v2}, Ljava/lang/Double;->doubleValue()D

    move-result-wide v2

    invoke-virtual {v1}, Ljava/lang/Double;->doubleValue()D

    move-result-wide v4

    div-double v1, v2, v4

    invoke-static {v1, v2}, Ljava/lang/Double;->valueOf(D)Ljava/lang/Double;

    move-result-object v1

    .line 198
    aget-object v2, v0, v8

    const-string v3, "/"

    invoke-virtual {v2, v3, v9}, Ljava/lang/String;->split(Ljava/lang/String;I)[Ljava/lang/String;

    move-result-object v2

    .line 199
    aget-object v3, v2, v7

    invoke-static {v3}, Ljava/lang/Double;->valueOf(Ljava/lang/String;)Ljava/lang/Double;

    move-result-object v3

    .line 200
    aget-object v2, v2, v8

    invoke-static {v2}, Ljava/lang/Double;->valueOf(Ljava/lang/String;)Ljava/lang/Double;

    move-result-object v2

    .line 201
    invoke-virtual {v3}, Ljava/lang/Double;->doubleValue()D

    move-result-wide v3

    invoke-virtual {v2}, Ljava/lang/Double;->doubleValue()D

    move-result-wide v5

    div-double v2, v3, v5

    invoke-static {v2, v3}, Ljava/lang/Double;->valueOf(D)Ljava/lang/Double;

    move-result-object v2

    .line 203
    aget-object v0, v0, v9

    const-string v3, "/"

    invoke-virtual {v0, v3, v9}, Ljava/lang/String;->split(Ljava/lang/String;I)[Ljava/lang/String;

    move-result-object v0

    .line 204
    aget-object v3, v0, v7

    invoke-static {v3}, Ljava/lang/Double;->valueOf(Ljava/lang/String;)Ljava/lang/Double;

    move-result-object v3

    .line 205
    aget-object v0, v0, v8

    invoke-static {v0}, Ljava/lang/Double;->valueOf(Ljava/lang/String;)Ljava/lang/Double;

    move-result-object v0

    .line 206
    invoke-virtual {v3}, Ljava/lang/Double;->doubleValue()D

    move-result-wide v3

    invoke-virtual {v0}, Ljava/lang/Double;->doubleValue()D

    move-result-wide v5

    div-double/2addr v3, v5

    invoke-static {v3, v4}, Ljava/lang/Double;->valueOf(D)Ljava/lang/Double;

    move-result-object v0

    .line 208
    new-instance v3, Ljava/lang/Double;

    invoke-virtual {v1}, Ljava/lang/Double;->doubleValue()D

    move-result-wide v4

    invoke-virtual {v2}, Ljava/lang/Double;->doubleValue()D

    move-result-wide v1

    const-wide/high16 v6, 0x404e

    div-double/2addr v1, v6

    add-double/2addr v1, v4

    invoke-virtual {v0}, Ljava/lang/Double;->doubleValue()D

    move-result-wide v4

    const-wide v6, 0x40ac200000000000L

    div-double/2addr v4, v6

    add-double v0, v1, v4

    invoke-direct {v3, v0, v1}, Ljava/lang/Double;-><init>(D)V

    .line 210
    return-object v3
.end method

.method private b(Landroid/media/ExifInterface;)[Ljava/lang/Double;
    .locals 10
    .parameter

    .prologue
    const/4 v9, 0x1

    const/4 v8, 0x0

    const-wide/16 v6, 0x0

    .line 150
    const/4 v0, 0x0

    .line 152
    const-string v1, "GPSLatitude"

    invoke-virtual {p1, v1}, Landroid/media/ExifInterface;->getAttribute(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    .line 153
    const-string v2, "GPSLatitudeRef"

    invoke-virtual {p1, v2}, Landroid/media/ExifInterface;->getAttribute(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    .line 154
    const-string v3, "GPSLongitude"

    invoke-virtual {p1, v3}, Landroid/media/ExifInterface;->getAttribute(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    .line 155
    const-string v4, "GPSLongitudeRef"

    invoke-virtual {p1, v4}, Landroid/media/ExifInterface;->getAttribute(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    .line 157
    if-eqz v1, :cond_0

    if-eqz v2, :cond_0

    if-eqz v3, :cond_0

    if-eqz v4, :cond_0

    .line 162
    const/4 v0, 0x2

    new-array v0, v0, [Ljava/lang/Double;

    .line 164
    const-string v5, "N"

    invoke-virtual {v2, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_1

    .line 165
    invoke-direct {p0, v1}, Lcom/instagram/android/support/camera/z;->b(Ljava/lang/String;)Ljava/lang/Double;

    move-result-object v1

    aput-object v1, v0, v8

    .line 170
    :goto_0
    const-string v1, "E"

    invoke-virtual {v4, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_2

    .line 171
    invoke-direct {p0, v3}, Lcom/instagram/android/support/camera/z;->b(Ljava/lang/String;)Ljava/lang/Double;

    move-result-object v1

    aput-object v1, v0, v9

    .line 177
    :cond_0
    :goto_1
    return-object v0

    .line 167
    :cond_1
    invoke-direct {p0, v1}, Lcom/instagram/android/support/camera/z;->b(Ljava/lang/String;)Ljava/lang/Double;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Double;->doubleValue()D

    move-result-wide v1

    sub-double v1, v6, v1

    invoke-static {v1, v2}, Ljava/lang/Double;->valueOf(D)Ljava/lang/Double;

    move-result-object v1

    aput-object v1, v0, v8

    goto :goto_0

    .line 173
    :cond_2
    invoke-direct {p0, v3}, Lcom/instagram/android/support/camera/z;->b(Ljava/lang/String;)Ljava/lang/Double;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Double;->doubleValue()D

    move-result-wide v1

    sub-double v1, v6, v1

    invoke-static {v1, v2}, Ljava/lang/Double;->valueOf(D)Ljava/lang/Double;

    move-result-object v1

    aput-object v1, v0, v9

    goto :goto_1
.end method


# virtual methods
.method protected varargs a([Landroid/net/Uri;)Ljava/lang/Void;
    .locals 10
    .parameter

    .prologue
    const/4 v1, 0x0

    .line 47
    const/4 v0, 0x0

    aget-object v0, p1, v0

    .line 48
    iget-object v2, p0, Lcom/instagram/android/support/camera/z;->b:Landroid/content/Context;

    invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    .line 55
    :try_start_0
    invoke-virtual {v3, v0}, Landroid/content/ContentResolver;->openInputStream(Landroid/net/Uri;)Ljava/io/InputStream;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0
    .catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v2

    .line 56
    :try_start_1
    iget-object v0, p0, Lcom/instagram/android/support/camera/z;->b:Landroid/content/Context;

    invoke-static {v0}, Lcom/instagram/k/a;->b(Landroid/content/Context;)Ljava/io/File;

    move-result-object v0

    .line 58
    invoke-static {v2, v0}, Lcom/instagram/k/a;->a(Ljava/io/InputStream;Ljava/io/File;)Z
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_1
    .catch Ljava/io/FileNotFoundException; {:try_start_1 .. :try_end_1} :catch_5

    move-result v4

    if-nez v4, :cond_2

    .line 82
    if-eqz v2, :cond_0

    .line 84
    :try_start_2
    invoke-virtual {v2}, Ljava/io/InputStream;->close()V
    :try_end_2
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_1

    .line 88
    :cond_0
    :goto_0
    if-eqz v1, :cond_1

    .line 89
    invoke-interface {v1}, Lcom/instagram/android/support/camera/a/d;->a()V

    .line 93
    :cond_1
    :goto_1
    return-object v1

    .line 61
    :cond_2
    :try_start_3
    invoke-static {v0}, Landroid/net/Uri;->fromFile(Ljava/io/File;)Landroid/net/Uri;

    move-result-object v4

    .line 63
    const/4 v0, 0x1

    invoke-static {v3, v4, v0}, Lcom/instagram/android/support/camera/ImageManager;->a(Landroid/content/ContentResolver;Landroid/net/Uri;I)Lcom/instagram/android/support/camera/a/d;
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_1
    .catch Ljava/io/FileNotFoundException; {:try_start_3 .. :try_end_3} :catch_5

    move-result-object v0

    .line 65
    :try_start_4
    invoke-interface {v0, v4}, Lcom/instagram/android/support/camera/a/d;->a(Landroid/net/Uri;)Lcom/instagram/android/support/camera/a/c;

    move-result-object v3

    iput-object v3, p0, Lcom/instagram/android/support/camera/z;->c:Lcom/instagram/android/support/camera/a/c;

    .line 67
    iget-object v3, p0, Lcom/instagram/android/support/camera/z;->c:Lcom/instagram/android/support/camera/a/c;

    if-eqz v3, :cond_3

    .line 69
    invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/Runtime;->maxMemory()J

    move-result-wide v5

    long-to-double v5, v5

    const-wide v7, 0x3fb47ae147ae147bL

    mul-double/2addr v5, v7

    double-to-int v3, v5

    div-int/lit8 v3, v3, 0x4

    .line 70
    iget-object v5, p0, Lcom/instagram/android/support/camera/z;->c:Lcom/instagram/android/support/camera/a/c;

    const/4 v6, -0x1

    const/4 v7, 0x1

    const/4 v8, 0x1

    invoke-interface {v5, v6, v3, v7, v8}, Lcom/instagram/android/support/camera/a/c;->a(IIZZ)Landroid/graphics/Bitmap;

    move-result-object v3

    iput-object v3, p0, Lcom/instagram/android/support/camera/z;->d:Landroid/graphics/Bitmap;

    .line 78
    :cond_3
    invoke-virtual {v4}, Landroid/net/Uri;->getPath()Ljava/lang/String;

    move-result-object v3

    invoke-direct {p0, v3}, Lcom/instagram/android/support/camera/z;->a(Ljava/lang/String;)V
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_2
    .catch Ljava/io/FileNotFoundException; {:try_start_4 .. :try_end_4} :catch_6

    .line 82
    if-eqz v2, :cond_4

    .line 84
    :try_start_5
    invoke-virtual {v2}, Ljava/io/InputStream;->close()V
    :try_end_5
    .catch Ljava/io/IOException; {:try_start_5 .. :try_end_5} :catch_2

    .line 88
    :cond_4
    :goto_2
    if-eqz v0, :cond_1

    .line 89
    invoke-interface {v0}, Lcom/instagram/android/support/camera/a/d;->a()V

    goto :goto_1

    .line 80
    :catch_0
    move-exception v0

    move-object v0, v1

    move-object v2, v1

    .line 82
    :goto_3
    if-eqz v2, :cond_5

    .line 84
    :try_start_6
    invoke-virtual {v2}, Ljava/io/InputStream;->close()V
    :try_end_6
    .catch Ljava/io/IOException; {:try_start_6 .. :try_end_6} :catch_3

    .line 88
    :cond_5
    :goto_4
    if-eqz v0, :cond_1

    .line 89
    invoke-interface {v0}, Lcom/instagram/android/support/camera/a/d;->a()V

    goto :goto_1

    .line 82
    :catchall_0
    move-exception v0

    move-object v2, v1

    :goto_5
    if-eqz v2, :cond_6

    .line 84
    :try_start_7
    invoke-virtual {v2}, Ljava/io/InputStream;->close()V
    :try_end_7
    .catch Ljava/io/IOException; {:try_start_7 .. :try_end_7} :catch_4

    .line 88
    :cond_6
    :goto_6
    if-eqz v1, :cond_7

    .line 89
    invoke-interface {v1}, Lcom/instagram/android/support/camera/a/d;->a()V

    :cond_7
    throw v0

    .line 85
    :catch_1
    move-exception v0

    goto :goto_0

    :catch_2
    move-exception v2

    goto :goto_2

    :catch_3
    move-exception v2

    goto :goto_4

    :catch_4
    move-exception v2

    goto :goto_6

    .line 82
    :catchall_1
    move-exception v0

    goto :goto_5

    :catchall_2
    move-exception v1

    move-object v9, v1

    move-object v1, v0

    move-object v0, v9

    goto :goto_5

    .line 80
    :catch_5
    move-exception v0

    move-object v0, v1

    goto :goto_3

    :catch_6
    move-exception v3

    goto :goto_3
.end method

.method protected a(Ljava/lang/Void;)V
    .locals 4
    .parameter

    .prologue
    .line 215
    invoke-super {p0, p1}, Landroid/os/AsyncTask;->onPostExecute(Ljava/lang/Object;)V

    .line 217
    iget-object v0, p0, Lcom/instagram/android/support/camera/z;->e:Lcom/instagram/android/support/camera/aa;

    if-eqz v0, :cond_0

    .line 218
    iget-object v0, p0, Lcom/instagram/android/support/camera/z;->e:Lcom/instagram/android/support/camera/aa;

    iget-object v1, p0, Lcom/instagram/android/support/camera/z;->c:Lcom/instagram/android/support/camera/a/c;

    iget-object v2, p0, Lcom/instagram/android/support/camera/z;->d:Landroid/graphics/Bitmap;

    iget-object v3, p0, Lcom/instagram/android/support/camera/z;->f:Lcom/instagram/android/support/camera/o;

    invoke-interface {v0, v1, v2, v3}, Lcom/instagram/android/support/camera/aa;->a(Lcom/instagram/android/support/camera/a/c;Landroid/graphics/Bitmap;Lcom/instagram/android/support/camera/o;)V

    .line 220
    :cond_0
    return-void
.end method

.method protected synthetic doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
    .locals 1
    .parameter "x0"

    .prologue
    .line 22
    check-cast p1, [Landroid/net/Uri;

    .end local p1
    invoke-virtual {p0, p1}, Lcom/instagram/android/support/camera/z;->a([Landroid/net/Uri;)Ljava/lang/Void;

    move-result-object v0

    return-object v0
.end method

.method protected synthetic onPostExecute(Ljava/lang/Object;)V
    .locals 0
    .parameter "x0"

    .prologue
    .line 22
    check-cast p1, Ljava/lang/Void;

    .end local p1
    invoke-virtual {p0, p1}, Lcom/instagram/android/support/camera/z;->a(Ljava/lang/Void;)V

    return-void
.end method
